<?php
/* @var $this UsuariosController */
/* @var $model usuarios */

/*$this->breadcrumbs=array(
	'Usuarioses'=>array('index'),
	'Manage',
);*/


Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$('#usuarios-grid').yiiGridView('update', {
		data: $(this).serialize()
	});
	return false;
});
");
?>

<h1>Usuarios</h1>

<!--<p>
You may optionally enter a comparison operator (<b>&lt;</b>, <b>&lt;=</b>, <b>&gt;</b>, <b>&gt;=</b>, <b>&lt;&gt;</b>
or <b>=</b>) at the beginning of each of your search values to specify how the comparison should be done.
</p>-->


<!-- _________________________________________ Tooltip __________________________________________________________ -->

<?php
$this->widget('application.extensions.tipsy.Tipsy', array(
  'fade' => false,
  'gravity' => 'n',
  'items' => array(
    array('id' => '.tooltipster'),
    array('id' => '#tooltipster'),
    array('id' => array('model' => $model, 'attribute' => 'model_attribute_name')
     ,'fallback' => 'Put custom tooltip here.' ),    
  ),  
));
?>

<!-- _________________________________________ Botton para agregar usuario__________________________________________ -->
<p align="right">
<?php //boton 
$this->widget('bootstrap.widgets.TbButton', array(
       'label'=>'Agregar usuario',
       'type'=>'primary',
       'size'=>'medium',
       'url'=>array('usuarios/create'),
      
   )); //fin boton  ?>
</p>


<!-- _________________________________________ Paginación ______________________________________________________ -->


<div align="right">

<?php
    $this->widget('ext.PageSize.EPageSize', array(
    'gridViewId' => 'usuarios-grid',
    'beforeLabel'=>'Registro por pantalla: ',
    'pageSize' => Yii::app()->request->getParam('pageSize',null),
    'defaultPageSize' =>  10 ,   // may use this :  Yii::app()->params['defaultPageSize'],
    'pageSizeOptions'=> array(5=>5, 10=>10, 25=>25, 50=>50, 75=>75, 100=>100), // you can config it in main.php under the config dir . Yii::app()->params['pageSizeOptions'],// Optional, you can use with the widget default
    ));
    ?>
 
 
<?php
$dataProvider = $model->search();
$pageSize = Yii::app()->user->getState('pageSize',10/*Yii::app()->params['defaultPageSize']*/);
$dataProvider->getPagination()->setPageSize($pageSize);
 
 ?>

</div>

<!-- _________________________________________ Gridview ______________________________________________________ -->


<?php $this->widget('bootstrap.widgets.TbGridView', array(
	// zii.widgets.grid.CGridView 
	'type'=>'striped bordered condensed',
	'id'=>'usuarios-grid',
	'dataProvider'=>$model->search(),
	'filter'=>$model,
	'template'=>"{summary}{items}{pager}",
	'itemsCssClass'=>'table table-striped table-bordered table-condensed tableNews',// mover por fila
    'enablePagination' => true,
	//'htmlOptions'=>array('style'=>'word-wrap:break-word; width:1050px;'),
	'columns'=>array(
		array('name'=>'Us_idusuario_PK', 'header'=>'Código'),
        array('name'=>'Us_nombrecompleto', 'header'=>'Nombre Completo'),
        array('name'=>'username', 'header'=>'Nombre de usuario'),
        array('name'=>'Us_telefono', 'header'=>'Teléfono'),
        array('name'=>'Us_direccion', 'header'=>'Dirección', 'htmlOptions'=>array('style'=>'width: 200px')),
		

		array(
            'class'=>'bootstrap.widgets.TbButtonColumn',
             'htmlOptions'=>array('style'=>'width: 70px'),
             'template'=>'{view} {update} {delete}  {suspender}',



			 'buttons'=>array
			         (
			         			            
			           'suspender' => array
			                (
			                    'label'=>'Activar/Suspender','icon'=>'off',
			                    //'imageUrl'=>'$model->activeImg($data->id)',	
			                  	//'imageUrl'=>Yii::app()->request->baseUrl.'/images/sus.png',
			                  	//'url'=>'Yii::app()->createUrl("/usuarios/accion_nueva?id=$data->id" )',                
			                    'url'=>'"#"',          
			                ),
			          ),
			           

			        ),
		/*array(
			'class'=>'CButtonColumn',
		),*/
	),
)); ?>


